package org.dromara.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.business.domain.GoodsOrder;
import org.dromara.business.domain.bo.GoodsOrderBo;
import org.dromara.business.domain.vo.GoodsOrderVo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;

import java.util.Collection;
import java.util.List;

/**
 * 订单Service接口
 *
 * @author Lion Li
 * @date 2025-06-13
 */
public interface GoodsOrderService extends IService<GoodsOrder> {

    /**
     * 查询订单
     */
    GoodsOrderVo queryById(Long goodsOrderId);

    /**
     * 查询订单列表
     */
    TableDataInfo<GoodsOrderVo> queryPageList(GoodsOrderBo bo, PageQuery pageQuery);

    /**
     * 查询订单列表
     */
    List<GoodsOrderVo> queryList(GoodsOrderBo bo);

    /**
     * 新增订单
     */
    Boolean insertByBo(GoodsOrderBo bo);

    /**
     * 修改订单
     */
    Boolean updateByBo(GoodsOrderBo bo);

    /**
     * 校验并批量删除订单信息
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);

    /**
     * 直接下单
     */
    GoodsOrder addOrder(GoodsOrderBo bo, int delay);

    GoodsOrder addOrderTopUp(GoodsOrderBo bo, Long buyFlag);

    GoodsOrder createOrderByShoppingCartId(Long[] shoppingCartId, GoodsOrderBo bo);

    /**
     * 购物车下单微信支付
     *
     * @param shoppingCartId 购物车id
     * @param bo             订单信息
     * @return
     */
    GoodsOrder createPayOrderByShoppingCartId(Long[] shoppingCartId, GoodsOrderBo bo);

    /**
     * 抢单
     */
    boolean check(Long goodsOrderId);

    /**
     * 派单
     */
    boolean dispatch(Long orderId, Long userId);

    /**
     * 抢单大厅列表
     */
    IPage<GoodsOrderVo> unCheckList(PageQuery pageQuery);

    /**
     * 取消订单
     */
    boolean removeOrder(Long orderId);

    /**
     * 打手完成订单
     *
     * @param orderId 订单id
     */
    boolean waiterEnd(Long orderId, String serverImg, String serverRemark);

    /**
     * 客户完成订单
     *
     * @param orderId 订单id
     */
    boolean end(Long orderId);

    boolean refund(Long orderId);

    List<String> getOrderNotice();


    boolean addMember(Long orderId, List<Long> list);

    /**
     * 将订单放回大厅订单
     *
     * @param orderId 订单id
     */
    boolean again(Long orderId);


}
